#if !defined(AFX_RECORDDLG_H__E2A29933_4DD0_4F7F_B9BB_7343DBC7B9D5__INCLUDED_)
#define AFX_RECORDDLG_H__E2A29933_4DD0_4F7F_B9BB_7343DBC7B9D5__INCLUDED_

#include "..\COMMON\cTypes.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RecordDlg.h : header file
//

#ifdef _JNC_REC_
#include "../Common/SNGlog.h"

#define RECORD_LOG_FNAME	"VC70Record.log"
#endif //def _JNC_REC_

/////////////////////////////////////////////////////////////////////////////
// CRecordDlg dialog

class RecordCamera
{
public:
	RecordCamera();
	~RecordCamera();

	CString m_strFile;
	CString m_strPrevDate;

	int m_nCameraID;
	CString m_strCameraIP;

	FILE* m_file;
	CMutex m_lockFile;

	int m_fps;
	int m_nCurrentFrameRate;
	int m_nStoredFrameRate;
	int m_nStoredBitrate;
	int m_nFileSize;
	int m_nFrameRate;

	long m_lTotalStoredData;

	DWORD m_timeStart;
	DWORD m_timeEnd;
	DWORD m_dwDelta;

	TimeMark m_tm;
	int				 *pSzAudio;// pointer to size of audio
	BYTE			 *dtAudio;// pointer to audio data
	CRITICAL_SECTION *pCriticalAudio;// pointer to critical section
	BYTE* m_pAudio;
	BYTE m_byPacketCounter;

	int				 *pSzVideo;// pointer to size of video
	BYTE			 *dtVideo;// pointer to video data
	int				 *pSzDate;// pointer to size of date
	BYTE			 *dtDate;// pointer to date
	int				 *pSzTime;// pointer to size of time
	BYTE			 *dtTime;// pointer to time
	CRITICAL_SECTION *pCriticalData;// pointer to critical section

	BYTE* m_pData;
	char m_szDate[50];
	char m_szTime[50];

	void ResetData();
};

class CRecordDlg : public CDialog
{
// Construction
public:
	BOOL m_bSpace;
	list<RecordCamera*> m_listRecordCameras;

	CRecordDlg(CWnd* pParent = NULL);   // standard constructor
#ifdef _JNC_REC_
	~CRecordDlg();
#endif //def _JNC_REC_

	BOOL CreateDlg();

	void UpdateCameraInfo(BOOL bChangeCamera = FALSE);
	void SaveCameraData(int nCameraID);
	void SaveCameraAudio(int nCameraID, BYTE n);

	BOOL CheckFreeSpace();
	BOOL CheckStartCamera(int nCameraID);
	void DeleteCamera(const char* szCameraIP);
	void Clear();
// Dialog Data
	//{{AFX_DATA(CRecordDlg)
	enum { IDD = IDD_RECORD };
	CEdit	m_editNewFrameRate;
	CButton	m_btnUpdate;
	CListBox	m_listCameras;
	CString	m_strDiskSpace;
	CString	m_strBitrate;
	CString	m_strCurFrameRate;
	CString	m_strFileName;
	CString	m_strFileSize;
	CString	m_strNewFrameRate;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRecordDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void PostNcDestroy();
	//}}AFX_VIRTUAL

// Implementation
protected:
	CWnd* m_pParent;
	int m_nID;

	// Generated message map functions
	//{{AFX_MSG(CRecordDlg)
	afx_msg void OnUpdate();
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT nIDEvent);
	virtual void OnCancel();
	afx_msg void OnAddCamera();
	afx_msg void OnDelete();
	afx_msg void OnSelchangeRecordCamera();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	char m_szBuffer[255];

	__int64 m_i64FreeBytesToCaller;
	__int64 m_i64TotalBytes;
	__int64 m_i64FreeBytes;

	DWORD m_dwSectPerClust;
	DWORD m_dwBytesPerSect;
	DWORD m_dwFreeClusters;
	DWORD m_dwTotalClusters;

	CTime m_time;

	CString m_str;

	DWORD m_dwTag;
	DWORD m_timeStart;
	DWORD m_timeEnd;
	DWORD m_dwDelta;
	DWORD m_wYear;
	DWORD m_sizeStr;
	DWORD m_dwLen;

#ifdef _JNC_REC_
	SNGLOG recordLog;
#endif //def _JNC_REC_
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RECORDDLG_H__E2A29933_4DD0_4F7F_B9BB_7343DBC7B9D5__INCLUDED_)
